# 子进程之间数据不共享
from multiprocessing import Process
a =100

def sub_process1(arg):
    print('子进程开始执行')
    global a
    a+=30
    print(a)
    print('子进程执行结束')

def sub_process2(arg):
    print('子进程2执行')
    global a
    a-=50
    print(a)
    print('子进程2执行完毕')

if __name__ == '__main__':
    print('父进程开始执行')

    p1 = Process(target=sub_process1, args=(1,))
    p2 = Process(target=sub_process2, args=(2,))

    p1.start()
    p2.start()
    p1.join()
    p2.join()
    print('父进程执行完毕')
    print('最终全局a的值是：',a)